package dao;

import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;
import pojo.User;
import util.DBHelper;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.List;

public class UserDao {
    static QueryRunner runner=new QueryRunner();
    public User getUser(String name) throws SQLException {
        Connection conn= DBHelper.getConnection();
        String sql="select * from user where name=?";
        User user= runner.query(conn,sql, new BeanHandler<User>(User.class),name);
        DBHelper.close(conn,null,null);
        return user;
    }
}
